package com.witfortos.kotlindemo.ui

import android.os.Bundle
import androidx.lifecycle.Observer
import com.witfortos.common.base.BaseActivity
import com.witfortos.common.utils.ToastUtils
import com.witfortos.kotlindemo.R
import com.witfortos.kotlindemo.mvvm.view_model.LoginVm
import kotlinx.android.synthetic.main.activity_login.*

class LoginAct : BaseActivity<LoginVm>() {


    override fun layoutId() = R.layout.activity_login;

    override fun initView(bundle: Bundle?) {
        login.setOnClickListener {
            viewModel.login(username.text.toString(), password.text.toString());
        };
        viewModel.user.observe(this, Observer {
            ToastUtils.showToast("登录成功!")
            MainAct.navigateToMainAct(this);
            finish()
        })
    }

    override fun initData() {

    }


}
